home *** CD-ROM | disk | FTP | other *** search
- package Local.Game.HUD
- {
- import Local.*;
- import Local.Game.Level.*;
- import Local.Game.Thing.*;
- import Local.Game.World.*;
- import Local.Game.World.Map.*;
- import Local.Game.World.Map.Cell.*;
- import STC9.IO.*;
- import STC9.System.*;
- import flash.display.*;
- import flash.events.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.text.*;
-
- public class CHUDPanel extends EventDispatcher
- {
-
- public static const DRAWPANEL:String = "DRAWPANEL";
-
- private static var mTabSelected:ColorTransform;
-
- private static var mPanelPosition:Point;
-
- private static var mTabHilight:ColorTransform;
-
- private static var mTabTextColor:uint;
-
- private static var mTabTextFilters:Array;
-
- public static const SELECTED:String = "SELECTED";
-
- private static var mTabNormal:ColorTransform;
-
-
- public var mDrawInit:Boolean = false;
-
- public var mcContainer:MovieClip;
-
- public var mSize:Rectangle;
-
- public var mPermanent:Boolean;
-
- internal var mID:String;
-
- internal var mHUD:CHUD;
-
- internal var mcPanel:MovieClip;
-
- private var mcTab:MovieClip;
-
- internal var mIcons:Array;
-
- public function CHUDPanel(param1:CHUD, param2:MovieClip, param3:MovieClip, param4:Boolean = false)
- {
- mDrawInit = false;
- super();
- mPermanent = param4;
- mHUD = param1;
- mcPanel = param2;
- mcTab = param3;
- if(mPermanent)
- {
- mcTab.visible = false;
- }
- mcPanel.mcSize.visible = false;
- mID = mcPanel.name.substr(7).toLowerCase();
- mcPanel.mPanel = this;
- mIcons = new Array();
- mSize = new Rectangle(mcPanel.mcSize.x,mcPanel.mcSize.y,mcPanel.mcSize.width,mcPanel.mcSize.height);
- mcPanel.addChild(mcContainer = new MovieClip());
- if(mcTab)
- {
- mcTab.mPanel = this;
- mcTab.addEventListener(MouseEvent.MOUSE_OVER,e_TAB_OVER);
- mcTab.addEventListener(MouseEvent.MOUSE_OUT,e_TAB_OUT);
- mcTab.addEventListener(MouseEvent.MOUSE_UP,e_TAB_UP);
- }
- mSelected = false;
- if(mcPanel.mcFader)
- {
- mcPanel.scrollRect = mSize;
- }
- }
-
- public static function SetDefaults(param1:MovieClip) : void
- {
- mTabSelected = param1.mcTabUnits.transform.colorTransform;
- mTabNormal = param1.mcTabStrikes.transform.colorTransform;
- mTabHilight = param1.mcTabUpgrades.transform.colorTransform;
- mTabTextFilters = param1.mcTabUnits.tbText.filters;
- mTabTextColor = param1.mcTabUnits.tbText.textColor;
- mPanelPosition = new Point(param1.mcPanelUnits.x,param1.mcPanelUnits.y);
- }
-
- public function DeselectAll() : void
- {
- var _loc1_:CHUDIcon = null;
- for each(_loc1_ in mIcons)
- {
- _loc1_.Deselect();
- }
- }
-
- private function RepositionIcons() : void
- {
- var _loc1_:int = 0;
- var _loc2_:int = 0;
- var _loc3_:CHUDIcon = null;
- _loc1_ = 5;
- _loc2_ = 5;
- for each(_loc3_ in mIcons)
- {
- _loc3_.x = _loc1_ + _loc3_.mIndex * (CHUDIcon.IconWidth + 5);
- _loc3_.y = _loc2_;
- }
- }
-
- public function ProcessIcons() : void
- {
- var _loc1_:CHUDIcon = null;
- for each(_loc1_ in mIcons.slice())
- {
- _loc1_.Process();
- }
- }
-
- public function Activate() : void
- {
- var _loc1_:CHUDPanel = null;
- for each(_loc1_ in mHUD.mPanels)
- {
- _loc1_.mSelected = _loc1_ == this ? true : false;
- }
- mDrawInit = false;
- dispatchEvent(new Event(SELECTED));
- }
-
- public function GetIcon(param1:String) : CHUDIcon
- {
- var _loc2_:CHUDIcon = null;
- for each(_loc2_ in mIcons)
- {
- if(_loc2_.mID == param1)
- {
- return _loc2_;
- }
- }
- return null;
- }
-
- public function AddIcon(param1:CHUDIcon) : void
- {
- param1.mIndex = mIcons.length;
- mIcons.push(param1);
- if(mcPanel.mcFader)
- {
- mcPanel.addChildAt(param1,mcPanel.getChildIndex(mcPanel.mcFader));
- }
- else
- {
- mcPanel.addChild(param1);
- }
- param1.Activate(true);
- RepositionIcons();
- }
-
- private function e_TAB_OUT(param1:MouseEvent = null) : void
- {
- if(true)
- {
- MovieClip(param1.currentTarget).mPanel.mHilightTab = false;
- }
- }
-
- public function Draw() : void
- {
- dispatchEvent(new Event(DRAWPANEL));
- }
-
- public function set mSelected(param1:Boolean) : void
- {
- if(true)
- {
- mHilightTab = false;
- if(true)
- {
- if(mcTab)
- {
- if(true)
- {
- if(param1)
- {
- if(true)
- {
- if(!mSelected)
- {
- if(true)
- {
- mcTab.buttonMode = false;
- if(true)
- {
- mcTab.useHandCursor = false;
- if(true)
- {
- mcTab.transform.colorTransform = mTabSelected;
- if(true)
- {
- mcTab.tbText.filters = mTabTextFilters;
- if(true)
- {
- mcTab.tbText.textColor = mTabTextColor;
- if(true)
- {
- addr90:
- mcPanel.x = mPanelPosition.x;
- addr94:
- mcPanel.y = mPanelPosition.y;
- mcPanel.visible = mPermanent ? true : param1;
- return;
- addr63:
- addr98:
- }
- else
- {
- addr69:
- if(mPermanent)
- {
- }
- §§goto(addr90);
- }
- §§goto(addr90);
- }
- mcTab.buttonMode = true;
- }
- mcTab.useHandCursor = true;
- }
- mcTab.transform.colorTransform = mTabNormal;
- }
- mcTab.tbText.filters = [];
- }
- mcTab.tbText.textColor = 16777215;
- §§goto(addr90);
- }
- §§goto(addr63);
- }
- §§goto(addr90);
- }
- else
- {
- §§push(mSelected);
- if(mSelected)
- {
- §§pop();
- §§goto(addr69);
- }
- }
- §§goto(addr69);
- }
- §§goto(addr94);
- }
- §§goto(addr90);
- }
- §§goto(addr98);
- }
- §§goto(addr90);
- }
-
- private function set mHilightTab(param1:Boolean) : void
- {
- if(true)
- {
- if(mSelected)
- {
- if(true)
- {
- return;
- }
- }
- else
- {
- if(!mcTab)
- {
- if(true)
- {
- return;
- }
- }
- else
- {
- mcTab.mHilight = param1;
- mcTab.transform.colorTransform = param1 ? mTabHilight : mTabNormal;
- mcTab.tbText.filters = [];
- }
- mcTab.tbText.textColor = 16777215;
- mcTab.buttonMode = true;
- }
- mcTab.useHandCursor = true;
- }
- }
-
- public function get mBuilding() : Boolean
- {
- var _loc1_:CHUDIcon = null;
- for each(_loc1_ in mIcons)
- {
- if(_loc1_.mBuild)
- {
- return true;
- }
- }
- return false;
- }
-
- public function get mStrikesReady() : Boolean
- {
- var _loc1_:CHUDIcon = null;
- for each(_loc1_ in mIcons)
- {
- if(true)
- {
- if(_loc1_.mLaunch)
- {
- return true;
- }
- }
- }
- return false;
- }
-
- public function get mSelected() : Boolean
- {
- return mcPanel.visible;
- }
-
- private function e_TAB_OVER(param1:MouseEvent = null) : void
- {
- MovieClip(param1.currentTarget).mPanel.mHilightTab = true;
- }
-
- private function get mHilightTab() : Boolean
- {
- return !!mcTab ? Boolean(mcTab.mHilight) : false;
- }
-
- public function RemoveIcon(param1:CHUDIcon) : void
- {
- var _loc2_:* = 0;
- if(true)
- {
- mcPanel.removeChild(param1);
- if(true)
- {
- mIcons.splice(mIcons.indexOf(param1),1);
- }
- §§push(0);
- if(true)
- {
- _loc2_ = §§pop();
- addr35:
- §§push(0);
- }
- for each(param1 in mIcons)
- {
- if(true)
- {
- param1.mIndex = _loc2_++;
- }
- }
- RepositionIcons();
- return;
- }
- §§goto(addr35);
- }
-
- private function e_TAB_UP(param1:MouseEvent = null) : void
- {
- MovieClip(param1.currentTarget).mPanel.Activate();
- }
- }
- }
-